package com.ftn;

import java.awt.*;

/**
 * User: Jack Fu
 * Date: 2024/9/4
 * Time: 16:53
 * To change this template use File | Settings | File Templates.
 * Description:
 */
public class BgObj extends GameObj{

    public BgObj() {
        setImage(GameUtils.bgImage);
        setX(0);
        // 为了图片滚动，并且最大坐标不能超过图片实际的高度
        setY(-1000);
        setSpeed(2);
    }

    public BgObj(int x, int y, int width, int height, Image image, int speed, GameWin gameWin) {
        super(x, y, width, height, image, speed, gameWin);
    }

    public BgObj(int x, int y, Image image, int speed) {
        super(x, y, image, speed);
    }

    @Override
    public void paintSelf(Graphics g) {
        g.drawImage(image, x, y, null);
        y += speed;
        if (y >= 0) {
            y = -1800;
        }
    }
}
